#pre-requisites
source "$METIS_HOME"metis-plugin.config

_pluginName=`basename $0 | sed -r 's/.sh$//'`
_pluginOutputDirectory="${pluginDir}${_pluginName}/"
mkdir ${_pluginOutputDirectory}

if [ -n "$1" ]; then
        timeout="$1"
else
        timeout=1800
fi
threads=20

############################################
# Notes
# At the moment it just brute forces the root user, want it to test against a number of usernames, e.g. user, cisco, etc
############################################

#body
query='select ipaddress from services where port = "22" and state = "open" and protocol = "tcp"'
cmd="${m_ncrack} -v -T4 --user root -P ${m_pass_wordlist} \${1}:22 &> ${_pluginOutputDirectory}\${1}.sshBruter"

"$pythonInterpreter" "$q2ex" -d "$database" -q "$query" -c "$cmd" -t "$threads" -T "$timeout" -o "$_pluginOutputDirectory" -e "$_pluginName" -L "$logginglevel" -O "$outputLog"
